﻿<?php
/*
 * @Author Akos Szabo - Axi
 * Created on Jul 5, 2011
 * @Project: ujej
 * @Description: This is the main page of the UJEJ site
 * 
 * @TODO:
 * OK-Main page
 * OK-Main Design
 * OK-Basic Session management - http://www.php.net/manual/en/session.configuration.php
 * OK-Capcha library
 * OK-Register - Simplest, but with captcha. No confirmation is required NOW.
 * OK-Login
 * -Forget PW sending
 * WIP-Basic Profil page - tabbed page, picture upload library - Ă‰n( tĂ¶rzsadatok, Ăˇlt mikor, Ăˇlt hol); Sportok; NaptĂˇr; csapat; ĂĽzenet
 * -Basic search page - Multi page list 
 * -Basic message board function to leave invitation and send answers.
 * -Load minimum data up to the page (location, sport places, sports, etc.)
 * -Mail function on Live environment
 * -finish all !!! market task. Find them in the code.
 * -GO LIVE on sportkereso.hu and ujej.hu
 * -Mobile version
 * -
 * 
 */

include_once 'include_1.php'; //common include


//Login event handler
$umail = $_POST['umail'];
$pw = $_POST['upw'];
$loginMsg="";
if($_POST['submit_login']<>"")
{
	writeLog("LOGIN");
	$oUser = new user_handler($dbh);
	$ujejId = $oUser->loginUser( $umail, $pw );
	if($ujejId == -1)//failed to login
	{
		writeLog("hibas Login");
		$loginMsg="HibĂˇs adatok! >> ";
		$ujejId = 0;
		$umail = "";
	}
	else
	{
		writeLog("jó Login id=".$ujejId);	
		$_SESSION['ujej_id'] = $ujejId;	
	}
	
}
else
{
//get information about the user
checkRequest();//tools.php	
}

//logout event handler
if( $cmd=="logout" )
{
	$ujejId = 0; 
	$_SESSION['ujej_id'] = 0;
	writeLog("LOGOUT");
	userLogout();
}
	




if( $ujejId > 0 )
{
	$topActionDiv = getTopActionDiv(1);	
}
else
{
	$topActionDiv = getTopActionDiv(0);	
}
	

//Create sport list
$sportslist = getSportList();
//Create area list
$arealist = getAreaList();

//Create menus
//create the main menu
$mainpage_mainmeu = getMainMenu();
$mainpage_leftmeu = "Main Page Left Menu";
$mainpage_left_stat = "Main Page Left Stat";
$mainpage_lastminute_list = "Main Page Last minute list";
$mainpage_impressum = "Main Page Impressum";


$level = gtSportLevelDescription();

writeLog(getHTTPHeader());
flushLog();

//include the template page of the main page
include"index_t.php";


?>
